cmake_minimum_required(VERSION 3.0)
project(PROJECT)
set(CMAKE_CXX_FLAGS"-std=c++11")
set(CMAKE_C_FLAGS"-std=c11")
# find_package(glog REQUIRED)
# include_directories( ${GLOG_INCLUDE_DIRS}) 

# 全局控制glog编译选项
option(BUILD_SHARED_LIBS "生成动态库" OFF)  # 控制静态/动态库编译:ml-citation{ref="1,4" data="citationList"}
option(WITH_GTEST "禁用GTest依赖" OFF)      # 根据需求关闭非必要依赖:ml-citation{ref="8" data="citationList"}

# 包含glog源码
add_subdirectory(glog-0.6.0)

include_directories(test PRIVATE  
    ${CMAKE_CURRENT_SOURCE_DIR}/glog-0.6.0/src
)
# 包含fmt源码
add_subdirectory(fmt-11.0.0)
include_directories(
    ${CMAKE_CURRENT_SOURCE_DIR}/fmt-11.0.0/include
)


# 主项目配置
add_executable(test src/main.cpp  src/GLogHelper.cpp src/CustomLogSink.cpp)
target_link_libraries(test glog::glog fmt::fmt)  # 链接glog库:ml-citation{ref="7,8" data="citationList"}


# 处理Unwind库缺失问题
if(NOT Unwind_FOUND)
    message(WARNING "Unwind library not found. Disabling Unwind support in glog.")
    add_definitions(-DGLOG_NO_UNWIND)
endif()

# add_executable(test src/main.cpp)
# target_link_libraries(
#     test  glog
# )


# add_executable(static static.cpp)
# target_link_libraries(
#    static    glog
# )

add_library(sdk_log STATIC src/sdk_log.cpp src/CustomLogSink.cpp)
target_link_libraries(sdk_log  glog::glog fmt::fmt -lm rt dl pthread)


include_directories(
    ${CMAKE_CURRENT_SOURCE_DIR}/src/
)
add_executable(test_log test/test_sdk_log.cpp  )
target_link_libraries(test_log sdk_log)
